package com.matrix.draft.sockettest.day8;


import com.matrix.draft.sockettest.day8.pojo.ThesisProto;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;

public class ProtoServerHandler extends SimpleChannelInboundHandler<ThesisProto.Thesis> {

    @Override
    protected void channelRead0(ChannelHandlerContext ctx, ThesisProto.Thesis msg) {
        System.out.println(String.format("Client : {论文ID:%s, 论文Title:%s, 论文内容:%s",msg.getId(),msg.getTitle(),msg.getContent()));
        ctx.writeAndFlush("已收到论文!");
    }

    @Override
    public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
        ctx.close();
    }
}
